################################################
# Put together all model evaluations
################################################

import pandas as pd
import os

# Setup repo paths
repo_main = '[CLASSIFIERS_PATH]'
repo_results = '[PROJECT_ABSOLUTE_PATH]/Data'
os.makedirs(os.path.join(repo_results, 'results'), exist_ok = True)



models_all = ['Full', 'Sub_EvaluateFed', 'Sub_EvaluateTrump', 'Sub_Inequality', 'Sub_PolicyHealthcare', 'Sub_Serious']

repo_sub = models_all[1]

for repo_sub in models_all:
    # Get list of eval files
    path = os.path.join(repo_main, repo_sub)
    model_names = os.listdir(path)

    model_results = []

    for mname in model_names:
        path_out = os.path.join(path, mname, 'output', 'training_progress_scores.csv')
        try:
            df_eval = pd.read_csv(path_out)
            df_eval['model_name'] = mname
            model_results.append(df_eval)
        except:
            next

    print(len(model_results))

    model_results_out = pd.concat(model_results)
    model_results_out.to_csv(os.path.join(repo_results, 'results', repo_sub+'.csv'))

